package com.lanswon.qzsmk.dao;


import java.util.List;

import org.apache.ibatis.annotations.Param;

import com.lanswon.qzsmk.model.StorageReg;
import com.lanswon.qzsmk.vo.RequestAndReturnRegInfoByEmpVo;
import com.lanswon.qzsmk.vo.StorageRegRecVo;
import com.lanswon.qzsmk.vo.StorageRegVo;


public interface StorageRegMapper {
	/**
	 * 查询入库单号
	 * @param record
	 * @return
	 */
    String queryStorageNo();
    
    /**
	 * 插入出入库记录
	 * @param record
	 * @return updateStorageNoByDistribute
	 */
    int insert(StorageReg storagereg);
    
    /**
	 * 更新接收标记
	 * @param storageNo 出入库单号
	 * @return 
	 */
    int updateStorageNoByDistribute(String storageNo);
    /**
	 * 查询网点接收信息
	 * @param 
	 * @return
	 */
	List<StorageRegRecVo> queryReceiveDistributeInfo(@Param("distributeTaskNo")String distributeTaskNo,@Param("applyBatchNo")String applyBatchNo,@Param("startLine")Integer startLine,@Param("numPerPage")Integer numPerPage);
	/**
	 * 根据任务编号查询网点接收配送信息
	 * @param taskNo
	 * @return
	 */
	List<StorageRegRecVo> queryCardReceivingByTaskNo(String taskNo);
	
	/**
	 * 根据入库流水号查询入库撤销信息
	 * @param companyNo
	 * @return
	 */
	StorageReg queryStorageRegByStorNo(String storageNo);
	
	/**
     * 分页查询
     */
    List<StorageRegRecVo> queryAllStorageReg(@Param("storageNo")String storageNo,
			@Param("storageMode")String storageMode,@Param("storageDateFrom")String storageDateFrom,
			@Param("storageDateTo")String storageDateTo,@Param("branchNo")String branchNo,
			@Param("startLine")Integer startLine,@Param("endLine")Integer endLine);
 
	/**
	 * 更新
	 * @param companyNo
	 * @return
	 */
	//void update(StorageReg sr);
    
	/**
	 * 查询能出库撤销信息
	 * @param currentPage 
	 * @param startLine 
	 * @param companyNo
	 * @return
	 */
	List<StorageRegRecVo> queryOutRevocation(@Param("storageNo")String storageNo,
			@Param("storageMode")String storageMode,@Param("storageDateFrom")String storageDateFrom,
			@Param("storageDateTo")String storageDateTo,@Param("branchNo")String branchNo, @Param("startLine")Integer startLine, @Param("endLine")Integer endLine);
	/**
	 * 查询能出库撤销信息的数量
	 * @param currentPage 
	 * @param startLine 
	 * @return
	 */
	Integer queryOutRevocationNumber(@Param("storageNo")String storageNo,
			@Param("storageMode")String storageMode,@Param("storageDateFrom")String storageDateFrom,
			@Param("storageDateTo")String storageDateTo,@Param("branchNo")String branchNo);
	/**
	 * 根据业务流水号查询能出库信息
	 * @param companyNo
	 * @return
	 */
	StorageRegVo queryOutgoRevoctionByStorageNo(String storageNo);
	
	/**
	 * 根据任务号查询申请批次号
	 * @param taskNoList
	 * @return
	 */
	List<StorageRegRecVo> queryApplyNoByTaskNo(@Param("taskNoList")List<String> taskNoList);
	
	/**
	 * 更具入库号，进行入库撤销
	 * @param storageNo
	 */
	void updateStorageRegByCancel(@Param("storageNo")String storageNo,@Param("curEmpNo")String curEmpNo,
			@Param("curBranchNo")String curBranchNo);
	
	/**
	 * 根据配送任务号，查询是否接收
	 * @param distributeTaskNo
	 * @return
	 */
	String queryStorageNoReceivingFlag(@Param("distributeTaskNo")String distributeTaskNo,@Param("branchNo")String branchNo);
	
	/**
	 * 根据出入库日期，出库如模式，出入库的网点查询出入库信息
	 * @param storageDateFrom
	 * @param storageDateTo
	 * @param storageMode
	 * @param storageBranchNo
	 * @return
	 */
	List<StorageRegVo> queryStorageSumList(@Param("storageDateFrom")String storageDateFrom, @Param("storageDateTo")String storageDateTo, 
			@Param("storageMode")String storageMode,@Param("storageBranchNo")String storageBranchNo);
	/**
	 * 根据出入库日期，出库如模式，出入库的网点查询出入库信息的数量
	 * @param storageDateFrom
	 * @param storageDateTo
	 * @param storageMode
	 * @param storageBranchNo
	 * @return
	 */
	int queryStorageSumListNumber(@Param("storageDateFrom")String storageDateFrom, @Param("storageDateTo")String storageDateTo, 
			@Param("storageMode")String storageMode,@Param("storageBranchNo")String storageBranchNo);
	/**
	 * 出入库撤销，回复是否接收标记
	 * @param storageNo
	 * @param curEmpNo
	 * @param curBranchNo
	 */
	void updateStorageReceiveByCancel(@Param("storageNo")String storageNo);
	
	/**
	 * 查询入库信息总数量
	 * @param storageNo
	 * @param storageMode
	 * @param storageDateFrom
	 * @param storageDateTo
	 * @param branchNo
	 * @return
	 */
	Integer countAllStorageReg(@Param("storageNo")String storageNo, @Param("storageMode")String storageMode, @Param("storageDateFrom")String storageDateFrom, @Param("storageDateTo")String storageDateTo,
			@Param("branchNo")String branchNo);
	
	/**
	 * 通过出入库单号，查询出入库状态
	 * @param storageNo
	 * @return
	 */
	String queryStorageStatusByStorageNo(@Param("storageNo")String storageNo);
	
	/**
	 * 通过出入库号，查询是否已经接收
	 * @param sourceStorageNo
	 * @return
	 */
	String queryIsReceiveByStorageNo(@Param("storageNo")String sourceStorageNo);
	
	/**
	 * 通过网点，日期查询出柜员领用情况
	 * @param branchNo
	 * @param storageDateFrom
	 * @param storageDateTo
	 * @return
	 */
	List<RequestAndReturnRegInfoByEmpVo> queryRequestAndReturnOFEmpReg(@Param("branchNo")String branchNo, @Param("storageDateFrom")String storageDateFrom,
			@Param("storageDateTo")String storageDateTo,@Param("userNoToQuery")String userNoToQuery,@Param("cardPName")String cardPName
			,@Param("requestOrReturn")String requestOrReturn);
	
}
